import unittest
from calculator import Calculator

class TestAdd(unittest.TestCase):
    """add()方法测试"""
    def test_add_integer(self):
        c = Calculator(3,5)
        self.assertEqual(c.add(),8)

    def test_add_decimals(self):
        """小数相加测试"""
        c = Calculator(3.1,3.8)
        self.assertEqual(c.add(),8)

    def test_add_string(self):
        """字符串整数相加测试"""
        c = Calculator("7","9")
        self.assertEqual(c.add(),16)


if __name__=='__main__':
    unittest.main()
